package com.ilikesoup.instant.monitor.sample;

import com.ilikesoup.instant.monitor.core.MonitorContext;

import java.util.HashMap;
import java.util.Map;
import java.util.function.Function;

public class SimpleMonitorContext implements MonitorContext {

    private Function serializer;

    private Map<String, Object> map = new HashMap<>();

    @Override
    public Object serialize(Object o) {
        return serializer.apply(o);
    }

    @Override
    public void put(String key, Object value) {
        map.put(key, value);
    }

    @Override
    public Object get(String key) {
        return map.get(key);
    }

    public Function getSerializer() {
        return serializer;
    }

    public void setSerializer(Function serializer) {
        this.serializer = serializer;
    }
}
